package cn.iocoder.yudao.module.exam.dal.mysql.exam;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.exam.ExamDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.exam.vo.*;

/**
 * 考试 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ExamMapper extends BaseMapperX<ExamDO> {

    default PageResult<ExamDO> selectPage(ExamPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ExamDO>()
                .likeIfPresent(ExamDO::getExamName, reqVO.getExamName())
                .eqIfPresent(ExamDO::getPaperId, reqVO.getPaperId())
                .likeIfPresent(ExamDO::getPaperName, reqVO.getPaperName())
                .eqIfPresent(ExamDO::getDuration, reqVO.getDuration())
                .eqIfPresent(ExamDO::getTotalScore, reqVO.getTotalScore())
                .eqIfPresent(ExamDO::getPassingScore, reqVO.getPassingScore())
                .betweenIfPresent(ExamDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(ExamDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(ExamDO::getEndType, reqVO.getEndType())
                .eqIfPresent(ExamDO::getTestNum, reqVO.getTestNum())
                .eqIfPresent(ExamDO::getScoreType, reqVO.getScoreType())
                .betweenIfPresent(ExamDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ExamDO::getVersion, reqVO.getVersion())
                .eqIfPresent(ExamDO::getSingleChoiceNum, reqVO.getSingleChoiceNum())
                .eqIfPresent(ExamDO::getMultipleChoiceNum, reqVO.getMultipleChoiceNum())
                .eqIfPresent(ExamDO::getTrueFalseNum, reqVO.getTrueFalseNum())
                .eqIfPresent(ExamDO::getShortAnswerNum, reqVO.getShortAnswerNum())
                .eqIfPresent(ExamDO::getEssayNum, reqVO.getEssayNum())
                .eqIfPresent(ExamDO::getSingleChoiceScore, reqVO.getSingleChoiceScore())
                .eqIfPresent(ExamDO::getMultipleChoiceScore, reqVO.getMultipleChoiceScore())
                .eqIfPresent(ExamDO::getMultipleChoicePartialScore, reqVO.getMultipleChoicePartialScore())
                .eqIfPresent(ExamDO::getTrueFalseScore, reqVO.getTrueFalseScore())
                .eqIfPresent(ExamDO::getFillTotalScore, reqVO.getFillTotalScore())
                .eqIfPresent(ExamDO::getSingleChoiceTotalScore, reqVO.getSingleChoiceTotalScore())
                .eqIfPresent(ExamDO::getMultipleChoiceTotalScore, reqVO.getMultipleChoiceTotalScore())
                .eqIfPresent(ExamDO::getCalculateNum, reqVO.getCalculateNum())
                .eqIfPresent(ExamDO::getFillNum, reqVO.getFillNum())
                .eqIfPresent(ExamDO::getShortAnswerTotalScore, reqVO.getShortAnswerTotalScore())
                .eqIfPresent(ExamDO::getEssayTotalScore, reqVO.getEssayTotalScore())
                .eqIfPresent(ExamDO::getCalculateTotalScore, reqVO.getCalculateTotalScore())
                .eqIfPresent(ExamDO::getEasyNum, reqVO.getEasyNum())
                .eqIfPresent(ExamDO::getCommonNum, reqVO.getCommonNum())
                .eqIfPresent(ExamDO::getMediumNum, reqVO.getMediumNum())
                .eqIfPresent(ExamDO::getDifficultNum, reqVO.getDifficultNum())
                .eqIfPresent(ExamDO::getExtremelyDifficultNum, reqVO.getExtremelyDifficultNum())
                .eqIfPresent(ExamDO::getEasyTotalScore, reqVO.getEasyTotalScore())
                .eqIfPresent(ExamDO::getCommonTotalScore, reqVO.getCommonTotalScore())
                .eqIfPresent(ExamDO::getMediumTotalScore, reqVO.getMediumTotalScore())
                .eqIfPresent(ExamDO::getDifficultTotalScore, reqVO.getDifficultTotalScore())
                .eqIfPresent(ExamDO::getExtremelyDifficultTotalScore, reqVO.getExtremelyDifficultTotalScore())
                .eqIfPresent(ExamDO::getTestType, reqVO.getTestType())
                .eqIfPresent(ExamDO::getPaperType, reqVO.getPaperType())
                .eqIfPresent(ExamDO::getPaperInfo, reqVO.getPaperInfo())
                .orderByDesc(ExamDO::getId));
    }

}